|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
EARModule.java | 100% | 63% | 53.8% | 63.6% |
|
1 |
/*
|
|
2 |
* Copyright 2001-2004 The Apache Software Foundation.
|
|
3 |
*
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
6 |
* You may obtain a copy of the License at
|
|
7 |
*
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9 |
*
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13 |
* See the License for the specific language governing permissions and
|
|
14 |
* limitations under the License.
|
|
15 |
*/
|
|
16 |
|
|
17 |
package org.apache.geronimo.ews.ws4j2ee.module;
|
|
18 |
|
|
19 |
import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
|
|
20 |
import org.apache.geronimo.ews.ws4j2ee.toWs.UnrecoverableGenerationFault;
|
|
21 |
import org.apache.geronimo.ews.ws4j2ee.utils.FileUtils;
|
|
22 |
import java.io.File;
|
|
23 |
import java.io.IOException;
|
|
24 |
import java.io.InputStream;
|
|
25 |
import java.util.ArrayList;
|
|
26 |
import java.util.Enumeration;
|
|
27 |
import java.util.Vector;
|
|
28 |
import java.util.zip.ZipEntry;
|
|
29 |
import java.util.zip.ZipFile;
|
|
30 |
|
|
31 |
/**
|
|
32 |
* @author hemapani@opensource.lk
|
|
33 |
*/
|
|
34 |
public class EARModule implements Module { |
|
35 |
private Module pkgModule;
|
|
36 |
private Vector classPathElements;
|
|
37 |
private ClassLoader parentCL;
|
|
38 |
|
|
39 |
/**
|
|
40 |
* @param jarFile
|
|
41 |
* @throws GenerationFault
|
|
42 |
*/
|
|
43 | 2 |
public EARModule(String jarFile,File outDir)
|
44 |
throws GenerationFault {
|
|
45 | 2 |
try {
|
46 | 2 |
ZipFile earFile = new ZipFile(jarFile);
|
47 | 2 |
Enumeration enumeration = earFile.entries(); |
48 | 2 |
int index = 0;
|
49 | 2 |
while (enumeration.hasMoreElements()) {
|
50 | 8 |
index++; |
51 | 8 |
ZipEntry entry = (ZipEntry) enumeration.nextElement(); |
52 | 8 |
if (entry.getName().endsWith(".war") || entry.getName().endsWith(".jar")) { |
53 | 2 |
File outWar = new File(new File(outDir,String.valueOf(index)), entry.getName()); |
54 | 2 |
FileUtils.uncompressFile(earFile.getInputStream(entry), outWar); |
55 | 2 |
pkgModule = ModuleFactory.createPackageModule(outWar.getAbsolutePath(),new File(outDir,String.valueOf(index)));
|
56 |
} |
|
57 |
} |
|
58 |
} catch (UnrecoverableGenerationFault e) {
|
|
59 | 0 |
e.printStackTrace(); |
60 | 0 |
throw GenerationFault.createGenerationFault(e);
|
61 |
} catch (IOException e) {
|
|
62 | 0 |
e.printStackTrace(); |
63 | 0 |
throw GenerationFault.createGenerationFault(e);
|
64 |
} |
|
65 |
} |
|
66 |
|
|
67 |
/**
|
|
68 |
* @return
|
|
69 |
* @throws GenerationFault
|
|
70 |
*/
|
|
71 | 2 |
public ClassLoader getClassLoaderWithPackageLoaded() throws GenerationFault { |
72 | 2 |
return pkgModule.getClassLoaderWithPackageLoaded();
|
73 |
} |
|
74 |
|
|
75 |
/**
|
|
76 |
* @return
|
|
77 |
* @throws GenerationFault
|
|
78 |
*/
|
|
79 | 1 |
public ArrayList getClassPathElements() throws GenerationFault { |
80 | 1 |
return pkgModule.getClassPathElements();
|
81 |
} |
|
82 |
|
|
83 | 0 |
public boolean equals(Object obj) { |
84 | 0 |
return pkgModule.equals(obj);
|
85 |
} |
|
86 |
|
|
87 |
/**
|
|
88 |
* @param path
|
|
89 |
* @return
|
|
90 |
* @throws GenerationFault
|
|
91 |
*/
|
|
92 | 1 |
public InputStream findFileInModule(String path) throws GenerationFault { |
93 | 1 |
return pkgModule.findFileInModule(path);
|
94 |
} |
|
95 |
|
|
96 |
/**
|
|
97 |
* @return
|
|
98 |
* @throws GenerationFault
|
|
99 |
*/
|
|
100 | 1 |
public InputStream getEjbJarfile() throws GenerationFault { |
101 | 1 |
return pkgModule.getEjbJarfile();
|
102 |
} |
|
103 |
|
|
104 |
/**
|
|
105 |
* @return
|
|
106 |
* @throws GenerationFault
|
|
107 |
*/
|
|
108 | 1 |
public InputStream getWebddfile() throws GenerationFault { |
109 | 1 |
return pkgModule.getWebddfile();
|
110 |
} |
|
111 |
|
|
112 |
/**
|
|
113 |
* @return
|
|
114 |
* @throws GenerationFault
|
|
115 |
*/
|
|
116 | 1 |
public InputStream getWscfFile() throws GenerationFault { |
117 | 1 |
return pkgModule.getWscfFile();
|
118 |
} |
|
119 |
|
|
120 |
/* (non-Javadoc)
|
|
121 |
* @see java.lang.Object#hashCode()
|
|
122 |
*/
|
|
123 | 0 |
public int hashCode() { |
124 | 0 |
return pkgModule.hashCode();
|
125 |
} |
|
126 |
|
|
127 |
/**
|
|
128 |
* @param stream
|
|
129 |
* @throws GenerationFault
|
|
130 |
*/
|
|
131 | 0 |
public void setEjbJarfile(InputStream stream) throws GenerationFault { |
132 | 0 |
pkgModule.setEjbJarfile(stream); |
133 |
} |
|
134 |
|
|
135 |
/**
|
|
136 |
* @param stream
|
|
137 |
* @throws GenerationFault
|
|
138 |
*/
|
|
139 | 0 |
public void setWebddfile(InputStream stream) throws GenerationFault { |
140 | 0 |
pkgModule.setWebddfile(stream); |
141 |
} |
|
142 |
|
|
143 |
/**
|
|
144 |
* @param stream
|
|
145 |
* @throws GenerationFault
|
|
146 |
*/
|
|
147 | 0 |
public void setWscfFile(InputStream stream) throws GenerationFault { |
148 | 0 |
pkgModule.setWscfFile(stream); |
149 |
} |
|
150 |
|
|
151 |
/* (non-Javadoc)
|
|
152 |
* @see java.lang.Object#toString()
|
|
153 |
*/
|
|
154 | 0 |
public String toString() {
|
155 | 0 |
return pkgModule.toString();
|
156 |
} |
|
157 |
} |
|
158 |
|
|